package com.wanmait.deliverymangementsystem.service.impl;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wanmait.deliverymangementsystem.service.NicknameService;
import org.springframework.stereotype.Service;

import org.springframework.beans.factory.annotation.Autowired;

import com.wanmait.deliverymangementsystem.mapper.NicknameMapper;
import com.wanmait.deliverymangementsystem.pojo.Nickname;

import java.util.List;

@Service
public class NicknameServiceImpl implements NicknameService {

    @Autowired
    private NicknameMapper nicknameMapper;

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return nicknameMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Nickname record) {
        return nicknameMapper.insert(record);
    }

    @Override
    public int insertSelective(Nickname record) {
        return nicknameMapper.insertSelective(record);
    }

    @Override
    public Nickname selectByPrimaryKey(Integer id) {
        return nicknameMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Nickname record) {
        return nicknameMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Nickname record) {
        return nicknameMapper.updateByPrimaryKey(record);
    }

    @Override
    public PageInfo<Nickname> findAll(Integer page) {
        PageHelper.startPage(page,7);
        List<Nickname> nicknames=nicknameMapper.findAll();
        return new PageInfo<>(nicknames,3);
    }

    @Override
    public List<Nickname> findBeforeAdd() {
        return nicknameMapper.findAll();
    }

}
